<?php
/**
 * Created by PhpStorm.
 * User: Dean.Wu
 * Date: 2018/03/16 0022
 * Time: 15:52
 */
namespace App\Http\Controllers\Home;
use App\Http\Controllers\Controller;
use App\Models\Post;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;

class IndexController extends Controller{

    public function __construct()
    {
        parent::__construct();
        //描述
        View::share('keyword','');

    }
    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @author Deann.wu
     * @name 首页页面
     */
    public function index(){
        $lists=Post::getHomeByNewData();
        return view('home.index.index',compact('lists'));
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @name 搜索内容
     * @author Deann.wu
     * @description
     *  目前做的是全栈搜索，后期迭代版本增加内容。
     */
    public function search(Request $request){
        $keyword=$request->input('keyword','');
        $lists=Post::getSearchData($keyword);
        return view('home.ext.search',compact('keyword','lists'));
    }

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     * @author Deann.wu
     * @name 个人简历
     */
    public function resume(){
        View::share('title','PHP攻城狮简历');
        return view('ext.resume');
    }
}